import { menuType } from "@/typrs/menu";

// 工具分类定义 - 温馨配色方案
export const toolCategories = [
    { id: 'all', name: '全部工具', color: '#6B73FF' },        // 温和的蓝紫色
    { id: 'development', name: '开发工具', color: '#52C41A' }, // 清新的绿色
    { id: 'format', name: '格式转换', color: '#FF9C6E' },      // 温暖的橙色
    { id: 'text', name: '文本处理', color: '#FFA940' },       // 柔和的橙黄色
    { id: 'query', name: '查询工具', color: '#FF85C0' },      // 温柔的粉色
    { id: 'generator', name: '生成器', color: '#40A9FF' },    // 天空蓝色
    { id: 'image', name: '图片工具', color: '#95DE64' },      // 温和的浅绿色
    { id: 'security', name: '安全工具', color: '#FFADD6' },   // 柔和的浅粉色
    { id: 'community', name: '互动交流', color: '#FF85C0' }   // 温柔的粉色
];

const tools = [
    {
        id: 1,
        title: 'Freemarker',
        description: 'Freemarker 模板工具',
        path: '/tools/freemarker',
        category: 'development'
    },
    {
        id: 2,
        title: 'Json',
        description: 'JSON格式化、压缩、转义、path查找',
        path: '/tools/json',
        category: 'development'
    },
    {
        id: 3,
        title: 'Timestamp',
        description: '时间戳转换工具',
        path: '/tools/timestamp',
        category: 'format'
    },
    {
        id: 4,
        title: 'Base64',
        description: 'base64加解密',
        path: '/tools/base64',
        category: 'format'
    },
    {
        id: 8,
        title: 'Address',
        description: '查找企业地址信息',
        path: '/tools/address',
        category: 'query'
    },
    {
        id: 9,
        title: 'JsonTable',
        description: 'JSON数据转表格',
        path: '/tools/jsontable',
        category: 'format'
    },
    {
        id: 10,
        title: 'TextCompare',
        description: '比较两段文本的差异',
        path: '/tools/textcompare',
        category: 'text'
    },
    // 新增的10个精选工具
    {
        id: 11,
        title: 'QRCode',
        description: '二维码生成器，支持文本、链接转二维码',
        path: '/tools/qrcode',
        category: 'generator'
    },
    {
        id: 12,
        title: 'UUID',
        description: 'UUID生成器，支持多种版本格式',
        path: '/tools/uuid',
        category: 'generator'
    },
    {
        id: 13,
        title: 'ColorPicker',
        description: '颜色选择器和颜色格式转换工具',
        path: '/tools/colorpicker',
        category: 'image'
    },
    {
        id: 14,
        title: 'ImageCompress',
        description: '在线图片压缩，支持多种格式',
        path: '/tools/imagecompress',
        category: 'image'
    },
    {
        id: 15,
        title: 'URLEncode',
        description: 'URL编码解码工具',
        path: '/tools/urlencode',
        category: 'format'
    },
    {
        id: 16,
        title: 'MD5Hash',
        description: 'MD5、SHA256等哈希值计算工具',
        path: '/tools/md5hash',
        category: 'security'
    },
    {
        id: 17,
        title: 'PasswordGen',
        description: '安全密码生成器，可自定义规则',
        path: '/tools/passwordgen',
        category: 'security'
    },
    {
        id: 18,
        title: 'RegexTest',
        description: '正则表达式测试工具',
        path: '/tools/regextest',
        category: 'development'
    },
    {
        id: 19,
        title: 'JSONPath',
        description: 'JSONPath表达式测试工具',
        path: '/tools/jsonpath',
        category: 'development'
    },
    {
        id: 20,
        title: 'Markdown',
        description: 'Markdown编辑器和预览工具',
        path: '/tools/markdown',
        category: 'text'
    },
    {
        id: 21,
        title: 'CorsTest',
        description: 'CORS跨域配置测试工具',
        path: '/tools/corstest',
        category: 'development'
    },
    {
        id: 22,
        title: 'MessageBoard',
        description: '留言板 - 欢迎留下您的宝贵意见和建议',
        path: '/tools/messageboard',
        category: 'community'
    }
];

export const toolsMenus = (): menuType[] => {
    return tools;
}

export const getToolsByCategory = (categoryId: string): menuType[] => {
    if (categoryId === 'all') {
        return tools;
    }
    return tools.filter(tool => tool.category === categoryId);
}

export const getCategoryById = (categoryId: string) => {
    return toolCategories.find(cat => cat.id === categoryId);
}